class SptitlesController < BaseController

  def index
   @school_message_news = News.index_news.where(is_important_news: 1).where(check:1).order("ordinal desc").order("pubtime desc").limit(10)
    @hot_sptitles = Sptitle.limit(3).order("ordinal desc").order("created_at desc")
    @pic_say_huali_news = News.where(check:1).limit(5)

    @sptitles = Sptitle.all.page(params[:page]).order("ordinal desc").order("created_at desc")
    
     get_right_news
    get_right_sptitles
    get_right_tshl
    
    
  end




def get_right_news
    #if @important == '1'
    #  important = 0
    #else
      important = 1
    #end
    @intro_news = News.index_news.where(is_important_news: important).where("pubtime>=?",30.days.ago).order("ordinal desc").order("hits desc").limit(10)
  end

  def get_right_sptitles
    @hot_sptitles = Sptitle.all.order("ordinal desc").order("created_at desc").limit(2)
  end

  def get_right_tshl
    @pic_say_huali_news = News.index_news.where(category_id: NewsHelper::TSHL_CATEGORY).order("created_at desc").limit(5)
  end
  
  
  
end
